﻿Imports System.Data.SqlClient

Public Class AdminChangeLocation
    Inherits System.Web.UI.Page
    Dim hang, ke, idsach As String
    Dim sach As New Sach_BLL()
    Dim p As New Sach_DTO()
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        spanhang.InnerText = Request.QueryString("hang")
        spanke.InnerText = Request.QueryString("ke")
        idsach = Request.QueryString("idsach")
    End Sub

    Protected Sub cb_chuyenke_Init(ByVal sender As Object, ByVal e As EventArgs) Handles cb_chuyenke.Init
        cb_chuyenke.DataSource = sach.Vitri_Ke()
        cb_chuyenke.DataBind()
        cb_chuyenke.SelectedIndex = 0
    End Sub

    Protected Sub bt_chuyen_Click(ByVal sender As Object, ByVal e As EventArgs) Handles bt_chuyen.Click
        Try
            p._idsach = idsach
            p._hang = cb_chuyenhang.SelectedItem.Value
            p._ke = cb_chuyenke.SelectedItem.Text
            sach.CapNhapViTri(p)
            successDiv.Attributes("class") = "alert alert-success"
            successDiv.Visible = True
            lb_mess.Text = "Chuyển Thành Công"
        Catch ex As SqlException
            successDiv.Attributes("class") = "alert alert-warning"
            successDiv.Visible = True
            lb_mess.Text = If(String.IsNullOrEmpty(ex.Message), "Chuyển Thất Bại", ex.Message)
        End Try

    End Sub
End Class